package com.park.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.park.model.InvoiceHistory;
import com.park.model.InvoiceRecording;
import com.park.model.SellerInformation;
import com.park.service.InvoiceHistoryService;
import com.park.service.InvoiceRecordingService;
import com.park.service.Utility;

@Controller
@RequestMapping("invoiceRecord")
public class InvoiceRecordingController {

	@Autowired
	private InvoiceRecordingService invoiceRecordingService;
	@Autowired
	private InvoiceHistoryService invoiceHistoryService;
	@RequestMapping(value="insert",method=RequestMethod.POST,produces={"application/json;charset=utf-8"})
	@ResponseBody
	public String insert(@RequestBody InvoiceRecording invoiceRecording){
		Map<String,Object> resultMap = new HashMap<String, Object>();
		int count = invoiceRecordingService.insert(invoiceRecording);
			resultMap.put("status", 1001);
			resultMap.put("message", "添加成功");
		return Utility.gson.toJson(resultMap);
	}
	
	@RequestMapping(value="insertInvoiceHistory",method=RequestMethod.POST,produces={"application/json;charset=utf-8"})
	@ResponseBody
	public String insert(@RequestBody InvoiceHistory invoiceHistory){
		Map<String,Object> resultMap = new HashMap<String, Object>();
		int count = invoiceHistoryService.insert(invoiceHistory);
			resultMap.put("status", 1001);
			resultMap.put("message", "添加成功");
		return Utility.gson.toJson(resultMap);
	}
}
